﻿//------------------------------------------------------------------------------------------------- 
// <copyright file="User.cs" company="Softec">
// Copyright (c) Softec.  All rights reserved.
// </copyright>
// <summary>Defines the User type.</summary>
//-------------------------------------------------------------------------------------------------


namespace WebQuestionnaire.Core
{
    using System;
    using System.Collections.Generic;
    using NHibernate.Validator.Constraints;
    using SharpArch.Core;
    using SharpArch.Core.DomainModel;

    /// <summary>
    /// Nhibernate Persestance Object
    /// </summary>
    public class Users : EntityWithTypedId<Guid>, IHasAssignedId<Guid>
    {
        /// <summary>
        /// Gets or sets UserName.
        /// </summary>
        [DomainSignature]
        [NotNullNotEmpty(Message = "Povinné pole")]
        public virtual string UserName { set; get; }

        /// <summary>
        /// Gets or sets Password.
        /// </summary>
        [DomainSignature]
        public virtual string Password { set; get; }


        public virtual string FirstName{set;get;}
        public virtual string LastName { set; get; }

        /// <summary>
        /// Gets or sets Email.
        /// </summary>
        [DomainSignature]
        [Email]
        public virtual string Email { set; get; }

        /// <summary>
        /// Gets or sets PasswordSalt.
        /// </summary>
        [DomainSignature]
        public virtual string PasswordSalt { set; get; }

        /// <summary>
        /// Gets or sets a value indicating whether Enabled.
        /// </summary>
        public virtual bool Enabled { set; get; }

        /// <summary>
        /// Gets or sets CreateDate.
        /// </summary>
        public virtual DateTime CreateDate { set; get; }

        /// <summary>
        /// Assigne Id to VO
        /// </summary>
        /// <param name="assignedId">Assigned Id</param>
        public virtual void SetAssignedIdTo(Guid assignedId)
        {
            Check.Require(assignedId!=Guid.Empty, "assignedId may not be empty");
            Id = assignedId;
        }

    }
}